package com.example.administrator.zkdemo.utils;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.Log;

/**
 * @author 丁可
 * @package com.example.administrator.zkdemo.utils
 * @fileName FaceDrawUtil
 * @date 2018/11/23 0023 9:34
 * @description
 * @org http://www.gshbzw.com/ 人和致远数据服务有限责任公司
 */
public class FaceDrawUtil {
    public static final boolean DEBUG = true;
    public static final String TAG = "FaceDrawUtil";

    public static void drawFace(Canvas paramCanvas, FaceInfo paramFaceInfo, Paint paramPaint) {
        if ((paramCanvas != null) && (paramFaceInfo != null)) {
            drawFaceRect(paramCanvas, paramFaceInfo.faceRect, paramPaint);
            drawPoints(paramCanvas, paramFaceInfo.facePoints, paramPaint);
            return;
        }
        Log.w("FaceDrawUtil", "drawFace canvas or faces is null !");
    }

    public static void drawFaceRect(Canvas paramCanvas, Rect paramRect, Paint paramPaint) {
        if (paramCanvas == null) {
            return;
        }
        paramCanvas.drawRect(paramRect, paramPaint);
    }

    public static void drawFaces(Canvas paramCanvas, FaceInfo[] paramArrayOfFaceInfo, Paint paramPaint) {
        if ((paramCanvas != null) && (paramArrayOfFaceInfo != null)) {
            int j = paramArrayOfFaceInfo.length;
            int i = 0;
            while (i < j) {
                drawFace(paramCanvas, paramArrayOfFaceInfo[i], paramPaint);
                i += 1;
            }
            return;
        }
        Log.w("FaceDrawUtil", "drawFaces canvas or faces is null !");
    }

    public static void drawPoints(Canvas paramCanvas, PointF[] paramArrayOfPointF, Paint paramPaint) {
        if (paramCanvas == null) {
            return;
        }
        int j = paramArrayOfPointF.length;
        int i = 0;
        while (i < j) {
            PointF localPointF = paramArrayOfPointF[i];
            paramCanvas.drawPoint(localPointF.x, localPointF.y, paramPaint);
            i += 1;
        }
    }
}